home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / network / ka9q / ka9q_src.arc / ARPDUMP.C < prev    next >
C/C++ Source or Header  |  1988-07-28  |  752b  |  39 lines

  1. #include <stdio.h>
  2. #include "global.h"
  3. #include "mbuf.h"
  4. #include "timer.h"
  5. #include "arp.h"
  6.  
  7. arp_dump(bpp)
  8. struct mbuf **bpp;
  9. {
  10.     struct arp arp;
  11.     char *inet_ntoa();
  12.  
  13.     if(bpp == NULLBUFP || *bpp == NULLBUF)
  14.         return;
  15.     printf("ARP: len %d",len_mbuf(*bpp));
  16.     if(ntoharp(&arp,bpp) == -1){
  17.         printf(" bad packet\n");
  18.         return;
  19.     }
  20.     if(arp.hardware < NHWTYPES)
  21.         printf(" hwtype %s",arptypes[arp.hardware]);
  22.     else
  23.         printf(" hwtype %u",arp.hardware);
  24.     printf(" prot 0x%x hwlen %u prlen %u",
  25.         arp.protocol,arp.hwalen,arp.pralen);
  26.     switch(arp.opcode){
  27.     case ARP_REQUEST:
  28.         printf(" op REQUEST");
  29.         break;
  30.     case ARP_REPLY:
  31.         printf(" op REPLY");
  32.         break;
  33.     default:
  34.         printf(" op %u",arp.opcode);
  35.         break;
  36.     }
  37.     printf(" target %s\n",inet_ntoa(arp.tprotaddr));
  38. }
  39.